#manually input p values of interaction terms from tables 7-9, 
#then use the "p adjust" package to calculate FDR-adjusted q-values

input<-("
         interaction               Raw.p
         under1_math_un         .642
         under1_math_adj             .439
         under1_literacy_un           .806
         under1_literacy_adj     .712
         under1_total_un  .755
         under1_total_adj    .614
         spill_math_un             .015
         spill_math_adj              .002
         spill_literacy_un              .223
         spill_literacy_adj            .027
         spill_total_un              .021
         spill_total_adj         .000
         u14_math_un          .012
         u14_math_adj    .003
         u14_literacy_un           .324
         u14_literacy_adj             .069
         u14_total_un     .044
         u14_total_adj       .006
         ")
Data <- read.table(textConnection(input),header=TRUE)

### Order data by p-value

Data <- Data[order(Data$Raw.p),]

# calculate q values

Data$BH = 
  p.adjust(Data$Raw.p, 
           method = "BH")
